<template>
	<view class="pics">
		<scroll-view class="left" scroll-y="true">
			<view :class="active == index ? 'active' : ''" v-for="(item,index) in cates" :key="index"
				@click="select(index)">{{item}}</view>
		</scroll-view>

		<scroll-view class="right" scroll-y="true">
			<view class="item" v-for="(item,index) in pictures" :key="index">
				<image :src="item" @click="preImg(item)"></image>
				<text class="word">我是图片简介</text>
			</view>
			<text v-if="pictures.length === 0" class="no-word">暂无数据啊</text>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				active: 1,
				cates: [
					'生活用品',
					'家具生活',
					'理财产品',
					'飞机大炮',
					'熟食凉菜',
					'热菜家常',
					'土豆回锅肉',
					'蒜薹炒肉',
					'西红柿炒鸡蛋',
					'小鸡炖蘑菇',
					'土豆烧牛腩',
					'酸辣土豆丝',
					'酸辣白菜',
					'酸辣豆芽',
					'飞机大炮',
					'熟食凉菜',
					'热菜家常',
					'土豆回锅肉',
					'蒜薹炒肉',
					'西红柿炒鸡蛋',
					'小鸡炖蘑菇',
					'土豆烧牛腩',
					'西红柿炒鸡蛋',
					'小鸡炖蘑菇',
					'土豆烧牛腩',
					'酸辣土豆丝',
				],
				pictures: ['../../static/1.jpg']
			}
		},
		methods: {
			select(index) {
				this.active = index;
				if (index == 1) {
					this.pictures = [
						'../../static/1.jpg'
					]
				} else if (index == 2) {
					this.pictures = [
						'../../static/2.jpg'
					]
				} else if (index == 3) {
					this.pictures = [
						'../../static/3.jpg'
					]
				} else if (index == 4) {
					this.pictures = [
						'../../static/4.jpg'
					]
				} else if (index == 5) {
					this.pictures = [
						'../../static/5.jpg'
					]
				} else if (index == 6) {
					this.pictures = [
						'../../static/6.jpg'
					]
				} else {
					this.pictures = []
				}
			},
			
			preImg(img) {
				uni.previewImage({
					urls: this.pictures,
					current: img
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	page {
		height: 100%;
	}

	.pics {
		height: 100%;
		display: flex;

		.left {
			width: 200rpx;
			height: 100%;
			border-right: 1rpx solid #eee;

			view {
				height: 100rpx;
				line-height: 100rpx;
				color: #333;
				text-align: center;
				font-size: 30rpx;
				border-top: 1rpx solid #eee;
			}

			.active {
				background: $shop-color;
				color: white;
			}
		}

		.right {
			height: 100%;
			width: 550rpx;
			.item {
				text-align: center;
				.image {
					width: 520rpx;
					height: 520rpx;
				}
				.word {
					font-size: 30rpx;
					line-height: 60rpx;
				}
			}
			
			.no-word {
				font-size: 30rpx;
				line-height: 60rpx;
				text-align: center;
				line-height: 100rpx;
				margin-left: 180rpx;
				
			}
			
		}
		
		
	}
</style>
